import SwitchPlatform from './component/SwitchPlatform'
import {
	clearChildNodes,
	copyComponent,
	deleteComponent,
	PlatformStyleType,
	redo,
	undo,
} from '@brickd/react'

export interface PlatformMenusType {
	[platformName: string]: PlatformStyleType
}

const platformMenus: PlatformMenusType = {
	'iPhone5/SE': [320, 568],
	'iPhone6/7/8': [375, 667],
	iPhoneX: [375, 812],
	iPad: [765, 1024],
	'iPad Pro': [1024, 1366],
}

/**
 * 工具栏配置
 */
const configs: any = [
	{
		span: 8,
		style: { justifyContent: 'flex-end' },
		group: [
			// {title:'属性重做',icon:'shuxing',event:'resetProps'},
		],
	},
	{
		span: 8,
		style: { justifyContent: 'flex-end' },
		group: [
			// { title: 'preview', icon: 'eye' },
			// { title: '导出代码', icon: 'export', event: 'outputFiles' },
			// { title: 'generateTemplate', icon: 'block' },
			{
				title: 'undo',
				icon: 'undo',
				shortcutKey: 'command+z/control+z',
				type: undo,
			},
			{
				title: 'redo',
				icon: 'redo',
				shortcutKey: 'command+shift+z/control+shift+z',
				type: redo,
			},
			{
				title: 'switchPlatform',
				icon: SwitchPlatform,
				props: { menus: platformMenus },
			},
		],
	},
	{
		span: 8,
		style: { justifyContent: 'flex-end', paddingRight: '50px' },
		group: [
			// { title: 'save', icon: 'save', type: ()=>{} },
			{ title: 'copy', icon: 'copy', type: copyComponent },
			{ title: 'clear', icon: 'rest', type: clearChildNodes },
			{ title: 'delete', icon: 'delete', type: deleteComponent },
		],
	},
]
export default configs

export const ENABLED = {
	selected: ['copy', 'delete', 'generateTemplate'],
	must: ['preview', 'save'],
}

export const CONTEXT_MENU = ['copy', 'clear', 'delete']

export const DefaultImgBase64 =
	''
